prepare-root: Rename `enabled` -> `composefs_enabled`
authorColin Walters <walters@verbum.org>
Wed, 16 Jul 2025 16:56:49 +0000 (12:56 -0400)
committerColin Walters <walters@verbum.org>
Wed, 16 Jul 2025 17:30:33 +0000 (13:30 -0400)
Prep for moving more functionality there, it's really about
the rootfs, not just composefs.

Signed-off-by: Colin Walters <walters@verbum.org>
src/libostree/ostree-soft-reboot.c
src/libostree/ostree-sysroot-deploy.c
src/libotcore/otcore-prepare-root.c
src/libotcore/otcore.h
src/switchroot/ostree-prepare-root.c

index 2c728a3c1094f0ebf9ef610562e9ff491f204878..7ed7e067ade9b44474d77930b656d791db20e643 100644 (file)
@@ -61,7 +61,7 @@ _ostree_prepare_soft_reboot (GError **error)
   if (!rootfs_config)
     return FALSE;
 
-  if (rootfs_config->enabled != OT_TRISTATE_YES)
+  if (rootfs_config->composefs_enabled != OT_TRISTATE_YES)
     return glnx_throw (error, "soft reboot not supported without composefs");
 
   GVariantBuilder metadata_builder;
index 749436bd3148953a20b4d6410d75c9e5ba838932..1b34833f3518b9351ff1b4d98f73180d79bb22dc 100644 (file)
@@ -661,7 +661,7 @@ checkout_deployment_tree (OstreeSysroot *sysroot, OstreeRepo *repo, const char *
   if (!rootfs_config)
     return glnx_prefix_error (error, "Reading rootfs config");
 
-  OtTristate composefs_enabled = rootfs_config->enabled;
+  OtTristate composefs_enabled = rootfs_config->composefs_enabled;
   g_debug ("composefs enabled by config: %d repo: %d", composefs_enabled, repo->composefs_wanted);
   if (repo->composefs_wanted == OT_TRISTATE_YES)
     composefs_enabled = repo->composefs_wanted;
index 98cb51d5ed3810c8565e8c45b3c77767d49b165b..df5d3b0db2df09ffbde616a7cd6f62f011872342 100644 (file)
@@ -188,19 +188,19 @@ otcore_load_rootfs_config (const char *cmdline, GKeyFile *config, gboolean load_
                                                    OTCORE_PREPARE_ROOT_ENABLED_KEY, NULL);
   if (g_strcmp0 (enabled, "signed") == 0)
     {
-      ret->enabled = OT_TRISTATE_YES;
+      ret->composefs_enabled = OT_TRISTATE_YES;
       ret->require_verity = true;
       ret->is_signed = true;
     }
   else if (g_strcmp0 (enabled, "verity") == 0)
     {
-      ret->enabled = OT_TRISTATE_YES;
+      ret->composefs_enabled = OT_TRISTATE_YES;
       ret->require_verity = true;
       ret->is_signed = false;
     }
   else if (!ot_keyfile_get_tristate_with_default (config, OTCORE_PREPARE_ROOT_COMPOSEFS_KEY,
                                                   OTCORE_PREPARE_ROOT_ENABLED_KEY, OT_TRISTATE_NO,
-                                                  &ret->enabled, error))
+                                                  &ret->composefs_enabled, error))
     return NULL;
 
   // Look for a key - we default to the initramfs binding path.
@@ -243,7 +243,7 @@ otcore_load_rootfs_config (const char *cmdline, GKeyFile *config, gboolean load_
     {
       if (g_strcmp0 (ostree_composefs, "signed") == 0)
         {
-          ret->enabled = OT_TRISTATE_YES;
+          ret->composefs_enabled = OT_TRISTATE_YES;
           ret->is_signed = true;
           ret->require_verity = true;
         }
@@ -251,7 +251,7 @@ otcore_load_rootfs_config (const char *cmdline, GKeyFile *config, gboolean load_
         {
           // The other states force off signatures
           ret->is_signed = false;
-          if (!_ostree_parse_tristate (ostree_composefs, &ret->enabled, error))
+          if (!_ostree_parse_tristate (ostree_composefs, &ret->composefs_enabled, error))
             return glnx_prefix_error (error, "handling karg " CMDLINE_KEY_COMPOSEFS), NULL;
         }
     }
@@ -450,7 +450,7 @@ otcore_mount_rootfs (RootConfig *rootfs_config, GVariantBuilder *metadata_builde
 #ifdef HAVE_COMPOSEFS
   /* We construct the new sysroot in /sysroot.tmp, which is either the composefs
      mount or a bind mount of the deploy-dir */
-  if (rootfs_config->enabled == OT_TRISTATE_NO)
+  if (rootfs_config->composefs_enabled == OT_TRISTATE_NO)
     return TRUE;
 
   g_autofree char *sysroot_objects = g_strdup_printf ("%s/ostree/repo/objects", root_mountpoint);
@@ -549,8 +549,8 @@ otcore_mount_rootfs (RootConfig *rootfs_config, GVariantBuilder *metadata_builde
   else
     {
       int errsv = errno;
-      g_assert (rootfs_config->enabled != OT_TRISTATE_NO);
-      if (rootfs_config->enabled == OT_TRISTATE_MAYBE && errsv == ENOENT)
+      g_assert (rootfs_config->composefs_enabled != OT_TRISTATE_NO);
+      if (rootfs_config->composefs_enabled == OT_TRISTATE_MAYBE && errsv == ENOENT)
         {
           g_print ("composefs: No image present\n");
         }
@@ -562,7 +562,7 @@ otcore_mount_rootfs (RootConfig *rootfs_config, GVariantBuilder *metadata_builde
     }
 #else
   /* if composefs is configured as "maybe", we should continue */
-  if (rootfs_config->enabled == OT_TRISTATE_YES)
+  if (rootfs_config->composefs_enabled == OT_TRISTATE_YES)
     return glnx_throw (error, "composefs: enabled at runtime, but support is not compiled in");
 #endif
   *out_using_composefs = using_composefs;
index 070498a21f1502a648f3b7dbfa70f8175390ce44..47aa751b54a0da457d7603956bd1199ea1f6af24 100644 (file)
@@ -66,7 +66,7 @@ GKeyFile *otcore_load_config (int rootfs, const char *filename, GError **error);
 
 typedef struct
 {
-  OtTristate enabled;
+  OtTristate composefs_enabled;
   gboolean require_verity;
   gboolean is_signed;
   char *signature_pubkey;
index 458997271323eed95dc2f096d5dd15d391e97d76..b00117998c7e50dd22178386d7f0b3c27f385781 100644 (file)
@@ -199,7 +199,7 @@ main (int argc, char *argv[])
 
   // If composefs is enabled, that also implies sysroot.readonly=true because it's
   // the new default we want to use (not because it's actually required)
-  const bool sysroot_readonly_default = rootfs_config->enabled == OT_TRISTATE_YES;
+  const bool sysroot_readonly_default = rootfs_config->composefs_enabled == OT_TRISTATE_YES;
   if (!ot_keyfile_get_boolean_with_default (config, SYSROOT_KEY, READONLY_KEY,
                                             sysroot_readonly_default, &sysroot_readonly, &error))
     errx (EXIT_FAILURE, "Failed to parse sysroot.readonly value: %s", error->message);
@@ -231,7 +231,7 @@ main (int argc, char *argv[])
    * However, we only do this if composefs is not enabled, because we don't
    * want to parse the target root filesystem before verifying its integrity.
    */
-  if (!sysroot_readonly && rootfs_config->enabled != OT_TRISTATE_YES)
+  if (!sysroot_readonly && rootfs_config->composefs_enabled != OT_TRISTATE_YES)
     {
       sysroot_readonly = sysroot_is_configured_ro (root_arg);
       // Encourage porting to the new config file